//
//  IntrinsicTableView.m
//  MingShi
//
//  Created by MJiao on 15/7/16.
//  Copyright (c) 2015年 MJiao. All rights reserved.
//

#import "IntrinsicTableView.h"

@implementation IntrinsicTableView

- (CGSize)intrinsicContentSize {
    [self layoutIfNeeded];
    NSLog(@"IntrinsicTableView.height:%f", self.contentSize.height);
    return CGSizeMake(UIViewNoIntrinsicMetric, self.contentSize.height);

    //return CGSizeMake(UIViewNoIntrinsicMetric, 1000);
}

- (void)endUpdates {
    [super endUpdates];
    [self invalidateIntrinsicContentSize];
}

- (void)reloadData {
    [super reloadData];
    [self invalidateIntrinsicContentSize];
}

- (void)reloadRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation {
    [super reloadRowsAtIndexPaths:indexPaths withRowAnimation:animation];
    [self invalidateIntrinsicContentSize];
}

- (void)reloadSections:(NSIndexSet *)sections withRowAnimation:(UITableViewRowAnimation)animation {
    [super reloadSections:sections withRowAnimation:animation];
    [self invalidateIntrinsicContentSize];
}

- (void)insertRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation {
    [super insertRowsAtIndexPaths:indexPaths withRowAnimation:animation];
    [self invalidateIntrinsicContentSize];
}

- (void)insertSections:(NSIndexSet *)sections withRowAnimation:(UITableViewRowAnimation)animation {
    [super insertSections:sections withRowAnimation:animation];
    [self invalidateIntrinsicContentSize];
}

- (void)deleteRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation {
    [super deleteRowsAtIndexPaths:indexPaths withRowAnimation:animation];
    [self invalidateIntrinsicContentSize];
}

- (void)deleteSections:(NSIndexSet *)sections withRowAnimation:(UITableViewRowAnimation)animation {
    [super deleteSections:sections withRowAnimation:animation];
    [self invalidateIntrinsicContentSize];
}

@end
